package net.hn.hnms.biz.safety.trinity.company.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.hn.hnms.biz.safety.trinity.company.service.HiddanGroupDangerRecordCompanyService;
import net.hn.hnms.sys.common.core.domain.R;
import net.hn.hnms.sys.common.core.domain.ResponsePage;
import net.hn.hnms.sys.common.mybatis.core.page.PageQuery;
import net.hn.hnms.biz.safety.trinity.entity.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.List;

/**
 * @author 智呈物联 nzw
 * @date 2023/1/5
 */
@RestController
@RequestMapping("company/manage/hiddenDangerRecord")
@Api(value = "安全隐患台账控制器", tags = {"公司端安全隐患台账"})
public class HiddenDangerRecordCompanyController {

    private HiddanGroupDangerRecordCompanyService hiddanGroupDangerRecordCompanyService;

    @Autowired
    public void setHiddanGroupDangerRecordCompanyService(HiddanGroupDangerRecordCompanyService hiddanGroupDangerRecordCompanyService) {
        this.hiddanGroupDangerRecordCompanyService = hiddanGroupDangerRecordCompanyService;
    }

    @GetMapping("hiddenDangerState")
    @ApiOperation("按隐患状态统计")
    public R<HiddenDangerStateVO> hiddenDangerState(String startTime, String endTime){
        return R.ok(hiddanGroupDangerRecordCompanyService.hiddenDangerState(startTime,endTime));
    }

    @GetMapping("hiddenDangerLevel")
    @ApiOperation("按隐患隐患等级统计")
    public R<HiddenDangerLevelVO> hiddenDangerLevel(String startTime, String endTime){
        return R.ok(hiddanGroupDangerRecordCompanyService.hiddenDangerLevel(startTime,endTime));
    }

    @GetMapping("hiddenDangerCompanyLevel")
    @ApiOperation("按隐患隐患等级统计-公司集团端(显示下级机构区分)")
    public R<List<HiddenDangerCompanyLevelVO>> hiddenDangerCompanyLevel(String startTime, String endTime){
        return R.ok(hiddanGroupDangerRecordCompanyService.hiddenDangerCompanyLevel(startTime,endTime));
    }

    @GetMapping("hiddenDangerDataTime")
    @ApiOperation("按隐患时间统计隐患数量")
    public R<HiddenDangerDateVO> hiddenDangerDataTime(String startTime, String endTime) throws ParseException {
        return R.ok(hiddanGroupDangerRecordCompanyService.hiddenDangerDataTime(startTime,endTime));
    }

    @GetMapping("hiddenDangerOverdueTime")
    @ApiOperation("按逾期时间统计隐患数量")
    public R<HiddenDangerDateVO> hiddenDangerOverdueTime(String startTime, String endTime){
        return R.ok(hiddanGroupDangerRecordCompanyService.hiddenDangerOverdueTime(startTime,endTime));
    }

    @GetMapping("hiddenDangerState/page")
    @ApiOperation("获取隐患列表")
    public R<ResponsePage<HiddenDangerCompanyVO>> hiddenDangerStatePage(PageQuery pageQuery, String state, String level, String mineCode, String overdueTime, String dataTime, String startTime, String endTime){
        return R.ok(hiddanGroupDangerRecordCompanyService.hiddenDangerStatePage(pageQuery,state,level,mineCode,overdueTime,dataTime,startTime,endTime));
    }

}
